
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="">
    <meta http-equiv="x-dns-prefetch-control" content="on">

    <title>订单列表</title>
    <link href="../../css/css.css" rel="stylesheet" type="text/css">
    <script src="../../js/jquery-v1.11.2.min.js"></script>
    <script src="../../js/common.js"></script>
    <script src="../../js/customer.js"></script>
</head>
<body>
<div id="orderList">

</div>
<script type="text/javascript">
$(function (){
	 //token验证
		checkToken();
	}); 
$(function (){
	
	var LocString = String(window.document.location.href); 
	//var callType=getCookie("callType"); 
	//GetArgsFromHref
	//'customerUuid':customerUuid
	var customerUuid=getCookie("customerUuid")
	 var url = _global.serverHost +'/consignerOrderManger/orderList.htm';
     var data = {
    	'orderStatus':'ALL',
    	'customerUuid':customerUuid
     };
     _callAjaxRequest(url, data, callBack);

     function callBack(data) {
    	 var orderListHtml='';
    	 var waybillList=data.waybillList;
    	 
    	 if(waybillList==null || waybillList.length<1){
    		 orderListHtml='暂无订单';
    	 }else{
    		 
    		 
    		 
    		 
    		 
    		 
    		 
    		 for(var i=0;i<waybillList.length;i++){
    			 orderListHtml=orderListHtml+'<section class="itemgroup mt10" >'
        		 +' <div class="order_title" onclick="goDetail(\''+waybillList[i].waybillId+'\')">'
        		 +'订单编号:'+ waybillList[i].waybillNum
        		 +'预定时间：'+waybillList[i].bookDateDesc;
    			 if(waybillList[i].waybillSource=='10'){
    				 orderListHtml=orderListHtml+'<label class="type ml5">APP</label>'
    			 }else if(waybillList[i].waybillSource=='20'){
    				 orderListHtml=orderListHtml+'<label class="type ml5">网站</label>'
    			 }else if(waybillList[i].waybillSource=='30'){
    				 orderListHtml=orderListHtml+'<label class="type ml5">客服电话</label>'
    			 }
         	            
    			 //orderListHtml=orderListHtml+'<label class="right gray">'+waybillList[i].bookDateDesc  ;
    			 orderListHtml=orderListHtml+'<label class="right gray">';
    			 if(waybillList[i].status=='30'){
    				 orderListHtml=orderListHtml+'进行中';
    			 }else if(waybillList[i].status=='40'){
    				 orderListHtml=orderListHtml+'就位';
    			 }else if(waybillList[i].status=='40'){
    				 orderListHtml=orderListHtml+'就位';
    			 }
    			 else if(waybillList[i].status=='50'){
    				 orderListHtml=orderListHtml+'装货完成';
    			 }
    			 else if(waybillList[i].status=='60'){
    				 orderListHtml=orderListHtml+'到达目的地';
    			 }
    			 else if(waybillList[i].status=='70'){
    				 orderListHtml=orderListHtml+'完成卸货';
    			 }
    			 else if(waybillList[i].status=='80'){
    				 orderListHtml=orderListHtml+'等待评价';
    			 }
    			 else if(waybillList[i].status=='90'){
    				 orderListHtml=orderListHtml+'订单完成';
    			 }else{
    				 orderListHtml=orderListHtml+'待处理';
    			 }
         	             
    			 orderListHtml=orderListHtml+'</div>';
    			 
    			 orderListHtml=orderListHtml+'<div class="photoitem ml15 font14" onclick="goDetail(\''+waybillList[i].waybillId+'\')">'
    			 +'<i class="iconfont mr5 green icon20">&#xe70d;</i>'
    			 +      waybillList[i].startAddr
    			 +' </div>';
    			 orderListHtml=orderListHtml+' <div class="photoitem ml15 font14" onclick="goDetail(\''+waybillList[i].waybillId+'\')">'
    			 +' <i class="iconfont mr5 red icon20">&#xe70c;</i>'
         	               + waybillList[i].endAddr
         	              +'</div> ';
         	              var requireList=data.requireList;
         	              
         	              if(requireList!=null && requireList.length>0){
         	            	  var index=0;
         	            	  for(var j=0;j<requireList.length;j++){
         	            		
         	            		if(requireList[j].waybillId==waybillList[i].waybillId){
         	            			if(index==0){
         	            				 orderListHtml=orderListHtml+'<div class="oneitem p15">'
                   	            		+'<label class="gray font12">特殊要求:</label>';
         	            			}
         	            			
         	            			 orderListHtml=orderListHtml+'<div class="comments_type right ';
         	            			/* if(requireList[j].index>0){
         	            				orderListHtml=orderListHtml+'mr5';
         	            			} */
         	            			orderListHtml=orderListHtml+'">'+requireList[j].requirementName+'</div>';
         	            			index++;
         	            		}
         	            		
         	            	  }
         	            	 orderListHtml=orderListHtml+'</div>';
         	              }
         	       
         	             orderListHtml=orderListHtml+'<div class="orderitem p15 lh40 font14">'
         	            +' 费用:<label class="red">￥'+waybillList[i].planTotalFee+'</label>'
         	            
         	            if(waybillList[i].status == '70'){
         	            	orderListHtml=orderListHtml+'<button type="button" class="btn right orderbtn" onclick="goFeeDetail(\''+waybillList[i].waybillId+'\')">支付</button>';
         	            } 
         	            if(waybillList[i].status == '80'){
         	            	orderListHtml=orderListHtml+'<button type="button" class="btn right orderbtn"  onclick="goOrderEvaluation(\''+waybillList[i].waybillId+'\')">评价</button>';
         	            }
         	             
         	           orderListHtml=orderListHtml+' </div>'
         	   +' </section>';
    	 }
    		 
    	}
    	 $("#orderList").html(orderListHtml);
     }
    	
});

    function goDetail(waybillId){
    	//详情页面
        //window.location.href= _global.serverHost +"/consignerOrderManger/orderOkDetail.htm?waybillId="+waybillId;
        window.location.href= "../../customer/order/order_detail.html?waybillId="+waybillId;
    }
    function goOrderEvaluation(waybillId){
    	//评价页面
       // window.location.href="${pageContext.request.contextPath}/consignerOrderManger/orderEvaluation.htm?waybillId="+waybillId;
        window.location.href="../../customer/order/order_ok.html?waybillId="+waybillId;
    }
    function goFeeDetail(waybillId){
    	//费用明细
       // window.location.href="${pageContext.request.contextPath}/consignerOrderManger/orderFeeDetail.htm?waybillId="+waybillId;
        window.location.href="../../customer/order/price_detail.html?waybillId="+waybillId;
    }

</script>
</body>
</html>